<?php defined('IN_PHPCMS') or exit('Access Denied'); ?><div class="window">
  <div class="window_content">
    <h4><a href="#" class="jqmClose"><img src="images/close.gif" alt="" height="16px" width="16px" /></a>选择模块</h4>
    <div id="protocol">
      <table style="margin-top:20px;">
        <tr>
          <td width="23%"><strong>博客名称</strong>：</td>
          <td width="77%"><input name="info[spacename]" id="spacename" type="text" value="<?php echo $spacename;?>" /></td>
        </tr>
      </table>
      <table style="margin-top:20px;">
        <tr>
          <th>模块</th>
          <th>操作管理</th>
        </tr>
        <?php if(is_array($block)) foreach($block AS $api) { ?>
        <tr>
          <td><?php echo $api['name'];?></td>
          <td>
  <?php if($api[installed]) { ?>
  <a href="javascript:void();" onclick="blockdel(<?php echo $api['apiid'];?>)">删除</a> 
  <?php } else { ?>
          <a href="javascript:void();" onclick="blockadd(<?php echo $api['apiid'];?>)">增加</a>
  <?php } ?>
  </td>
        </tr>
        <?php } ?>
      </table>
    </div>
  </div>
</div>
<script language="javascript">
var apiid;
function blockadd(apiid)
{
$.post("<?php echo $M['url'];?>block.php", {action:'edit', userid:<?php echo $_userid;?>, blockid: apiid}, function(data) {
window.location.reload();
});
}
function blockdel(apiid)
{
$.get("<?php echo $M['url'];?>block.php", {action:'del', userid:<?php echo $_userid;?>, blockid: apiid}, function(data) {
window.location.reload();
});
}

$('#spacename').blur(function()
{
$('#err').hide();
if(Common.strlen($('#spacename').val()) > 30)
{
$('#spacename').after('<font color="red" id="err">空间名称不得大于30个字符</font>');
return false;
}
$.post("<?php echo $M['url'];?>block.php", {action:'editspacename', spacename:$('#spacename').val(), userid:<?php echo $_userid;?>}, function(data) {
});
$("#logo > h1").html($('#spacename').val());
});
</script>